<?php

/**
 * This is the model class for table "cec".
 *
 * The followings are the available columns in table 'cec':
 * @property integer $id
 * @property string $academic_plan
 * @property string $student_status
 * @property string $fund_source
 * @property string $full_name_degree
 * @property string $nick_name
 * @property string $birth_city
 * @property string $birth_date
 * @property string $mailing_address
 * @property string $city
 * @property string $postal_code
 * @property string $telephone
 * @property string $email
 * @property string $phone_cellular
 * @property string $sex
 * @property string $marital_status
 * @property string $church
 * @property string $active_serving
 * @property string $institution_name
 * @property string $position
 * @property string $office_address
 * @property string $office_city
 * @property string $office_email
 * @property string $office_postal_code
 * @property string $office_telephone
 * @property string $insitution_status
 * @property string $academic_name
 * @property string $field_study
 * @property integer $bachelor_enrollment
 * @property integer $bachelor_graduation
 * @property integer $master_enrollment
 * @property integer $master_graduation
 * @property integer $doctor_enrollment
 * @property integer $doctor_graduation
 * @property double $ipk_academic
 * @property double $ipk_state
 * @property string $university_status
 * @property string $other_education_name
 * @property string $other_education_place
 * @property string $other_education_field
 * @property integer $other_education_year
 * @property integer $other_education_year_attended
 * @property string $created_at
 */
class Cec extends CActiveRecord
{
  public $verifyCode;
  public $uploadedFile;
  
	/**
	 * Returns the static model of the specified AR class.
	 * @return Cec the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'cec';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
      array('active_serving, nick_name, student_status, fund_source, bachelor_enrollment, postal_code, bachelor_graduation, master_enrollment, master_graduation, doctor_enrollment, doctor_graduation, ipk_academic, ipk_state, office_postal_code, university_status, other_education_name, other_education_place, other_education_field, other_education_year, other_education_year_attended, created_at, photo', 'safe'),
			array('academic_plan, full_name_degree, birth_city, birth_date, mailing_address, city, telephone, email, phone_cellular, sex, marital_status, church, institution_name, position, office_address, office_city, office_email, office_telephone, academic_name, field_study', 'required'),
			array('id, bachelor_enrollment, bachelor_graduation, master_enrollment, master_graduation, doctor_enrollment, doctor_graduation, other_education_year, other_education_year_attended', 'numerical', 'integerOnly'=>true),
			array('ipk_academic, ipk_state', 'numerical'),
			array('academic_plan, student_status, fund_source, nick_name, birth_city, birth_date, postal_code, telephone, email, phone_cellular, sex, marital_status, church, position, office_address, office_city, office_email, office_postal_code, office_telephone, insitution_status, university_status, other_education_name, other_education_place, other_education_field', 'length', 'max'=>500),
			array('full_name_degree, mailing_address, city, active_serving, institution_name, academic_name, field_study', 'length', 'max'=>1000),
      // array('verifyCode', 'CaptchaExtendedValidator', 'allowEmpty'=>!CCaptcha::checkRequirements()),
      array('uploadedFile', 'file', 'types'=>'jpg, gif, png', 'allowEmpty' => true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, academic_plan, student_status, fund_source, full_name_degree, nick_name, birth_city, birth_date, mailing_address, city, postal_code, telephone, email, phone_cellular, sex, marital_status, church, active_serving, institution_name, position, office_address, office_city, office_email, office_postal_code, office_telephone, insitution_status, academic_name, field_study, bachelor_enrollment, bachelor_graduation, master_enrollment, master_graduation, doctor_enrollment, doctor_graduation, ipk_academic, ipk_state, university_status, other_education_name, other_education_place, other_education_field, other_education_year, other_education_year_attended, created_at', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'academic_plan' => 'Academic Plan',
			'student_status' => 'Student Status',
			'fund_source' => 'Source of fund',
			'full_name_degree' => 'Full Name with degree',
			'nick_name' => 'Nick Name',
			'birth_city' => 'Place of birth',
			'birth_date' => 'Date of birth',
			'mailing_address' => 'Mailing Address',
			'city' => 'City',
			'postal_code' => 'Postal Code',
			'telephone' => 'Telephone',
			'email' => 'Email',
			'phone_cellular' => 'Phone Cellular',
			'sex' => 'Sex',
			'marital_status' => 'Marital Status',
			'church' => 'Church',
			'active_serving' => 'Actively Serving in',
			'institution_name' => 'Institution Name',
			'position' => 'Position',
			'office_address' => 'Office Address',
			'office_city' => 'City',
			'office_email' => 'Email',
			'office_postal_code' => 'Postal Code',
			'office_telephone' => 'Telephone',
			'academic_name' => 'Name and Place of Undergraduate/Graduate/Post Graduate Program University',
			'field_study' => 'Field of Study/Program of Study /Faculty',
			'bachelor_enrollment' => '(S-1) Year of Enrollment',
			'bachelor_graduation' => 'Year of Graduation',
			'master_enrollment' => '(S-2) Year of Enrollment',
			'master_graduation' => 'Year of Graduation',
			'doctor_enrollment' => '(S-3) Year of Enrollment',
			'doctor_graduation' => 'Year of Graduation',
			'ipk_academic' => 'Undergraduate/Graduate/Post Graduate GPA',
			'ipk_state' => 'State Exam GPA',
			'university_status' => 'Status of Undergraduate/Graduate/Post Graduate',
			'other_education_name' => 'Other Education Name',
			'other_education_place' => 'Other Education Place',
			'other_education_field' => 'Other Education Field',
			'other_education_year' => 'Other Education Year',
			'other_education_year_attended' => 'Other Education Year Attended',
			'created_at' => 'Created At',
      'photo' => 'Photo',
      'uploadedFile' => 'Photo',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('academic_plan',$this->academic_plan,true);
		$criteria->compare('student_status',$this->student_status,true);
		$criteria->compare('fund_source',$this->fund_source,true);
		$criteria->compare('full_name_degree',$this->full_name_degree,true);
		$criteria->compare('nick_name',$this->nick_name,true);
		$criteria->compare('birth_city',$this->birth_city,true);
		$criteria->compare('birth_date',$this->birth_date,true);
		$criteria->compare('mailing_address',$this->mailing_address,true);
		$criteria->compare('city',$this->city,true);
		$criteria->compare('postal_code',$this->postal_code,true);
		$criteria->compare('telephone',$this->telephone,true);
		$criteria->compare('email',$this->email,true);
		$criteria->compare('phone_cellular',$this->phone_cellular,true);
		$criteria->compare('sex',$this->sex,true);
		$criteria->compare('marital_status',$this->marital_status,true);
		$criteria->compare('church',$this->church,true);
		$criteria->compare('active_serving',$this->active_serving,true);
		$criteria->compare('institution_name',$this->institution_name,true);
		$criteria->compare('position',$this->position,true);
		$criteria->compare('office_address',$this->office_address,true);
		$criteria->compare('office_city',$this->office_city,true);
		$criteria->compare('office_email',$this->office_email,true);
		$criteria->compare('office_postal_code',$this->office_postal_code,true);
		$criteria->compare('office_telephone',$this->office_telephone,true);
		$criteria->compare('insitution_status',$this->insitution_status,true);
		$criteria->compare('academic_name',$this->academic_name,true);
		$criteria->compare('field_study',$this->field_study,true);
		$criteria->compare('bachelor_enrollment',$this->bachelor_enrollment);
		$criteria->compare('bachelor_graduation',$this->bachelor_graduation);
		$criteria->compare('master_enrollment',$this->master_enrollment);
		$criteria->compare('master_graduation',$this->master_graduation);
		$criteria->compare('doctor_enrollment',$this->doctor_enrollment);
		$criteria->compare('doctor_graduation',$this->doctor_graduation);
		$criteria->compare('ipk_academic',$this->ipk_academic);
		$criteria->compare('ipk_state',$this->ipk_state);
		$criteria->compare('university_status',$this->university_status,true);
		$criteria->compare('other_education_name',$this->other_education_name,true);
		$criteria->compare('other_education_place',$this->other_education_place,true);
		$criteria->compare('other_education_field',$this->other_education_field,true);
		$criteria->compare('other_education_year',$this->other_education_year);
		$criteria->compare('other_education_year_attended',$this->other_education_year_attended);
		$criteria->compare('created_at',$this->created_at,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}